// 事项类型定义
export interface ActivityType {
  id: string;
  name: string;
  coinValue: number; // 正数表示获得，负数表示消耗
  icon: string;
  color: string;
  isCustom?: boolean;
  createdAt?: Date;
  updatedAt?: Date;
}

// 情绪类型定义
export interface MoodType {
  id: string;
  name: string;
  coinValue: number; // 正数表示奖励，负数表示惩罚
  emoji: string;
  color: string;
  createdAt: Date;
  updatedAt: Date;
}

// 记录条目
export interface Entry {
  id: string;
  activityId: string;
  activityName: string;
  moodId: string;
  moodName: string;
  content: string;
  images: string[]; // 图片URL数组
  timestamp: Date;
  userSelectedTime: boolean; // 是否用户手动选择时间
  coinEarned: number; // 实际获得的金币（活动金币 + 情绪金币）
  createdAt: Date;
  updatedAt: Date;
}

// 用户设置
export interface UserSettings {
  id: string;
  totalCoins: number;
  defaultActivities: string[]; // 默认显示的活动ID列表
  defaultMoods: string[]; // 默认显示的情绪ID列表
  theme: 'light' | 'dark' | 'auto';
  autoSaveInterval: number; // 自动保存间隔（秒）
  showAnimations: boolean;
  language: 'zh' | 'en';
  createdAt: Date;
  updatedAt: Date;
}

// 统计数据接口
export interface Statistics {
  totalEntries: number;
  totalCoins: number;
  coinsEarned: number;
  coinsSpent: number;
  mostFrequentActivity: string;
  mostFrequentMood: string;
  currentStreak: number; // 连续记录天数
  longestStreak: number;
}

// 筛选条件
export interface FilterOptions {
  dateRange: {
    start: Date;
    end: Date;
  };
  activityIds: string[];
  moodIds: string[];
  sortBy: 'timestamp' | 'coinEarned' | 'activityName';
  sortOrder: 'asc' | 'desc';
}

// 图表数据类型
export interface ChartDataPoint {
  date: string;
  value: number;
  label?: string;
  color?: string;
}

export interface MoodDistribution {
  moodName: string;
  moodEmoji: string;
  count: number;
  percentage: number;
  color: string;
}

export interface CoinAnalysis {
  source: string;
  amount: number;
  count: number;
  color: string;
  type: 'income' | 'expense';
}

// 组件Props类型
export interface ViewMode {
  current: 'timeline' | 'activity' | 'mood' | 'calendar';
}

export interface Activity {
  id: string;
  title: string;
  activityType: string;
  mood: string;
  content: string;
  images?: string[];
  timestamp: Date;
  coinChange: number;
  createdAt: Date;
  updatedAt: Date;
}

export interface MoodConfig {
  id: string;
  name: string;
  emoji: string;
  coinModifier: number;
  color: string;
}

export interface Settings {
  totalCoins: number;
  activityTypes: ActivityType[];
  moodConfigs: MoodConfig[];
  defaultMoods: MoodConfig[];
}

export type NavigationTab = 'add' | 'activities' | 'calendar' | 'mood' | 'wealth' | 'analytics' | 'settings';

// API响应类型
export interface ApiResponse<T> {
  success: boolean;
  data: T;
  message?: string;
  error?: string;
}